import api from '@API'
import { Analytic_Type } from '@CONSTANTS/analytic'
import { trackEvent as TrackEvent } from '@UTILS/track'
interface SceneDataITF {
  PrevScene?: string
  RequestId: string
  Scene: string
}
export const painManagementRecord : unknown = (trackId: string, obj: unknown, sceneData: SceneDataITF) => {
  if (!trackId || !sceneData.Scene) return
  try {
    const params = {
      ...sceneData,
      Key: trackId,
    }
    // eslint-disable-next-line @typescript-eslint/ban-ts-comment
    if (obj) { // @ts-ignore
      params.Value = obj
    }
    api.painManagementRecord(params)
    // eslint-disable-next-line no-empty
  } catch (e) {}
}

export function trackEvent(analyticTypeKey: string, eventObj?: unknown, sceneData?: unknown) :void {
  TrackEvent(Analytic_Type?.[analyticTypeKey].eventId, eventObj, sceneData)
}
